var utils = require('../../../utils/util.js')
var c = require('../../../utils/config.js')
Page({
    data: {
        comment_icon1: false,
        comment_icon2: false,
        comment_icon3: false,
        commentList:[],
        img_url:c.img_url,
        page: 1,
    },
    onLoad: function (options) {
        this.getComment();
    },
    //下拉刷新
    onPullDownRefresh: function () {
      this.setData({
        commentList:[],
        page: 1,
      });
      this.getComment();
    },
    //上拉加载
    onReachBottom:function () {
      this.getComment();
    },
    getComment: function () {
        var that = this;
        var token = wx.getStorageSync("userinfo").wap_token;
        var data = {
            url: "/v1/goodsevaluate/myevaluate",
            token: token,
            page: that.data.page,
            limit: 10,

        };
        utils.request(data).then(function (res) {
            if (res.code == 0) {
                var data = res.data;
                if (data.length > 0){
                  that.setData({
                    page: that.data.page + 1
                  });
                }
                that.setData({
                  commentList: that.data.commentList.concat(data),
                });
            } else {

            }
            wx.stopPullDownRefresh();
        });
    }
})